home *** CD-ROM | disk | FTP | other *** search
- Path: news.orst.edu!butch
- From: preddym@ucs.orst.edu (M Preddy)
- Newsgroups: comp.lang.c++
- Subject: help with cin.getline()
- Date: Fri, 16 Feb 96 21:42:44 GMT
- Organization: Oregon State University
- Message-ID: <4g2tiv$gc0@news.orst.edu>
- NNTP-Posting-Host: butch.physics.orst.edu
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- Please forgive my newbie naivity, but I'm having trouble with
- cin.getline() under MSVC++ 4.0. Why does the following snipit,
-
-
- char cd_query[4];
- do
- {
- cout << "Constant Cd (y/n)? ";
- cin.getline(cd_query,4);
- } while (cd_query[0] !='n' && cd_query[0] != 'y');
-
-
- Produce the following output before stopping to wait for user input:
-
- Constant Cd (y/n)? Constant Cd (y/n)?
-
- The do-loop executes once, without stopping for input until the second
- pass. This is obviously not what I want. Thank you for your help.
-
- Mark
-